package com.algorithm.hqy;

import com.altorithm.QuickSort;

import static com.altorithm.Common.*;

/**
 * @Classname Test
 * @Date 2019/9/29 9:50
 * @auther by hqy
 */
public class Test {

    public static void main(String[] args) {
        int[] array = new int[100000];
        init(array);
        QuickSort.sort(array, 0, array.length - 1);
        long binaryBegin = System.currentTimeMillis();
        System.out.println(BinarySearches.searches(array, 100));
        long binaryEnd = System.currentTimeMillis();
        System.out.println("二分查找耗时" + (binaryEnd - binaryBegin));

        long insertBegin = System.currentTimeMillis();
        int i = InterpolationSearches.searches(array, 100);
        if (i != -1) {
            System.out.println(array[i]);
        }
        System.out.println(i);
        long insertEnd = System.currentTimeMillis();
        System.out.println("插值查找耗时" + (insertEnd - insertBegin));


        //System.out.println(FibSearch.getValue(30));

        long fibBegin = System.currentTimeMillis();
        System.out.println(FibSearch.findKey(array, 100));
        long fibEnd = System.currentTimeMillis();
        System.out.println("斐波拉契查找耗时" + (fibEnd - fibBegin));
    }
}


